package com.chenjun.core.service.activiti.impl;

import javax.annotation.Resource;

import org.activiti.engine.IdentityService;
import org.springframework.stereotype.Service;

import com.chenjun.core.dao.generator.entity.SysUserRole;
import com.chenjun.core.service.activiti.SynUserRoleToActivitiService;

@Service
public class SynUserRoleToActivitiServiceImpl implements SynUserRoleToActivitiService {

	@Resource
	private IdentityService identityService;
	
	@Override
	public void addMembership(SysUserRole record) {
		String userID = record.getUserId();
		String roleID = record.getRoleId();
		identityService.createMembership(userID, roleID);
	}

	@Override
	public void deleteMembership(SysUserRole record) {
		String userID = record.getUserId();
		String roleID = record.getRoleId();
		identityService.deleteMembership(userID, roleID);
	}

}
